package com.esri.core.tasks.geodatabase;

import com.esri.core.internal.util.d;
import java.io.IOException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class LayerSyncInfo {
    private static final String CLIENT_GEN_FIELDNAME = "clientGen";
    private static final String ID_FIELDNAME = "id";
    private static final String IS_ATTACHMENT_FIELDNAME = "isAttachment";
    private static final String NAME_FIELDNAME = "name";
    private static final String SERVER_GEN_FIELDNAME = "serverGen";
    private static final String SYNC_DIRECTION_FIELDNAME = "syncDirection";
    private boolean _isAttachment;
    private String _name;
    private SyncDirection _syncDirection;
    private int _layerId = -1;
    private long _serverGen = 0;
    private long _clientGen = 0;

    public int getLayerId() {
        return this._layerId;
    }

    public void setLayerId(int i) {
        this._layerId = i;
    }

    public long getServerGen() {
        return this._serverGen;
    }

    public void setServerGen(long j) {
        this._serverGen = j;
    }

    public long getClientGen() {
        return this._clientGen;
    }

    public void setClientGen(long j) {
        this._clientGen = j;
    }

    public SyncDirection getSyncDirection() {
        return this._syncDirection;
    }

    public void setSyncDirection(SyncDirection syncDirection) {
        this._syncDirection = syncDirection;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void toJson(JsonGenerator jsonGenerator) throws JsonGenerationException, IOException {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeNumberField(ID_FIELDNAME, this._layerId);
        jsonGenerator.writeNumberField(SERVER_GEN_FIELDNAME, this._serverGen);
        jsonGenerator.writeNumberField(CLIENT_GEN_FIELDNAME, this._clientGen);
        jsonGenerator.writeStringField(SYNC_DIRECTION_FIELDNAME, this._syncDirection.getValue());
        jsonGenerator.writeStringField(NAME_FIELDNAME, this._name);
        jsonGenerator.writeStringField(IS_ATTACHMENT_FIELDNAME, this._isAttachment ? "true" : "false");
        jsonGenerator.writeEndObject();
    }

    public static LayerSyncInfo fromJson(JsonParser jsonParser) throws Exception {
        if (d.c(jsonParser)) {
            LayerSyncInfo layerSyncInfo = new LayerSyncInfo();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if (ID_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._layerId = jsonParser.getIntValue();
                } else if (SERVER_GEN_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._serverGen = jsonParser.getLongValue();
                } else if (CLIENT_GEN_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._clientGen = jsonParser.getLongValue();
                } else if (SYNC_DIRECTION_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._syncDirection = SyncDirection.fromString(jsonParser.getText());
                } else if (NAME_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._name = jsonParser.getText();
                } else if (IS_ATTACHMENT_FIELDNAME.equals(currentName)) {
                    layerSyncInfo._isAttachment = jsonParser.getText().equals("true");
                } else {
                    jsonParser.skipChildren();
                }
            }
            return layerSyncInfo;
        }
        return null;
    }

    public int hashCode() {
        long j = this._clientGen;
        int i = (((((((int) (j ^ (j >>> 32))) + 31) * 31) + (this._isAttachment ? 1231 : 1237)) * 31) + this._layerId) * 31;
        String str = this._name;
        int hashCode = str == null ? 0 : str.hashCode();
        long j2 = this._serverGen;
        int i2 = (((i + hashCode) * 31) + ((int) ((j2 >>> 32) ^ j2))) * 31;
        SyncDirection syncDirection = this._syncDirection;
        return i2 + (syncDirection != null ? syncDirection.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            LayerSyncInfo layerSyncInfo = (LayerSyncInfo) obj;
            if (this._clientGen == layerSyncInfo._clientGen && this._isAttachment == layerSyncInfo._isAttachment && this._layerId == layerSyncInfo._layerId) {
                String str = this._name;
                if (str == null) {
                    if (layerSyncInfo._name != null) {
                        return false;
                    }
                } else if (!str.equals(layerSyncInfo._name)) {
                    return false;
                }
                return this._serverGen == layerSyncInfo._serverGen && this._syncDirection == layerSyncInfo._syncDirection;
            }
            return false;
        }
        return false;
    }
}
